package haemers.reflection.tests 
{
	import nl.haemers.data.constants.ReflectionConstants;
	import nl.haemers.data.reflection.Arg;
	import org.flexunit.Assert;
	/**
	 * ...
	 * @author Jonathan
	 */
	public class ArgTest 
	{
		private var _nameArg:Arg;
		private var _ignoreArg:Arg;
		private var _methodArg:Arg;
		
		/** Public methods **/
		[Before]
		public function setup() : void
		{
			_nameArg = new Arg(_nameXML);
			_ignoreArg= new Arg(_ignoreXML);
			_methodArg = new Arg(_paramsXML);
		}
		
		[Test]
		public function testSerializeName() : void
		{
			Assert.assertEquals(ReflectionConstants.ATTRIBUTE_NAME, _nameArg.key);
			Assert.assertEquals(ReflectionConstants.ATTRIBUTE_NAME, _nameArg.toString());
			Assert.assertEquals("idNo", _nameArg.value);
		}
		
		[Test]
		public function testSerializeIgnore() : void
		{
			Assert.assertEquals(ReflectionConstants.ATTRIBUTE_IGNORE, _ignoreArg.key);
			Assert.assertEquals(ReflectionConstants.ATTRIBUTE_IGNORE, _ignoreArg.toString());
			Assert.assertEquals("true", _ignoreArg.value);
		}
		
		[Test]
		public function testSerializeMethod() : void
		{
			Assert.assertEquals(ReflectionConstants.PARAMS_NAME, _methodArg.key);
			Assert.assertEquals(ReflectionConstants.PARAMS_NAME, _methodArg.toString());
			Assert.assertEquals("id,object,description", _methodArg.value);
		}
		
		[After]
		public function teardown() : void
		{
			_nameArg = null;
			_nameXML = null;
			
			_ignoreArg = null;
			_ignoreXML = null;
			
			_methodArg = null;
			_paramsXML = null;
		}
		/** Getters & Setters **/
		
		/** Protected methods **/
		
		/** Private methods **/
		private var _nameXML:XML = new XML(
			<arg key="name" value="idNo"/>
		)
		
		private var _ignoreXML:XML = new XML(
			<arg key="ignore" value="true"/>
		)
		
		private var _paramsXML:XML = new XML(
			<arg key="params" value="id,object,description"/>
		)
	}

}